from typing import List

"""
274. H 指数
https://leetcode.cn/problems/h-index/description/?envType=study-plan-v2&envId=top-interview-150
"""


class Solution:
    def hIndex(self, citations: List[int]) -> int:
        citations.sort(reverse=True)
        a = 0
        for i, c in enumerate(citations):
            if c < i + 1:
                return i
            else:
                a += 1
        return a


if __name__ == "__main__":
    print(Solution().hIndex([10, 23, 134]))
